home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
pxewin.zip
/
DBDISPLY.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1992-02-14
|
7KB
|
237 lines
// PXEWIN - (C) Copyright 1992 by Beam Engineering, INC.
// DBDISPLY.HPP //
// Contents ----------------------------------------------------------------
//
// This module is used to interface the PDOX Engine with the OWL. List
// boxes are used to display the contents of each field in the database.
// An array of list box parameters keeps track of each list box.
//
// This header contains the following items:
//
// 1. Messages used for dispatching between OWL classes.
//
// 2. LB_PARM. This structure is for parametric defining each list
// box.
// 3. Class DBDISPLAY. Displays the database in page format with 20
// records per page.
//
// Most of the persistant object interface has been left undefined
// up to this point. The reason for this is due to the changability
// of the database. If your operating on a Network and sharing a table
// then there is a lot that can happen to a database between sessions.
// About the only thing your going to need to save is the record
// pointer and field pointer and even they might not be valid in your
// next session. DBDISPLAY saves off the record pointer to the stream
// and also checks for it's validity at the beginning of your next
// session.
//
// End ---------------------------------------------------------------------
// External Reference Name for this Header ---------------------------------
#ifndef DBDISPLY_HPP
#define DBDISPLY_HPP
// End ---------------------------------------------------------------------
// Interface Dependendies --------------------------------------------------
#ifndef __STRING_H
#include <string.h>
#endif // __STRING_H //
#ifndef __STDIO_H
#include <stdio.h>
#endif // __STDIO_H //
#ifndef __OWL_H
#include <owl.h>
#endif // __OWL_H //
#ifndef __FILEDIAL_H
#include <filedial.h>
#endif // __FILEDIAL_H //
#ifndef __MDI_H
#include <mdi.h>
#endif // __MDI_H //
#ifndef __LISTBOX_H
#include <listbox.h>
#endif // __LISTBOX_H //
#ifndef __STATIC_H
#include <static.h>
#endif // __STATIC_H //
#ifndef __EDIT_H
#include <edit.h>
#endif // __EDIT_H //
#ifndef PXDIS_CPP
#include "pxdis.cpp"
#endif // PXDIS_CPP //
// End ---------------------------------------------------------------------
#define PAGE_SIZE 20 /* The number of records in
a page */
#define WM_CHKCHILD 0x400 /* To send a message to the
BrowserFrame when a
child is destroyed */
#define WM_SETWTCUR 0x401 /* Cursor wait message */
#define WM_SETNMCUR 0x402 /* Cursor normal message */
#define WM_PXERROR 0x403 /* PX Engine Error */
#define CM_OPENED 0x1 /* Open desktop */
#define CM_SAVEDT 0x2 /* Save desktop */
// structure LB_PARM //
// You'll need to references the following in advance of their definitions.
_CLASSDEF(PXListBox)
class PXListBox; /* Redefined TListBox for
Engine compatibility. */
_CLASSDEF(Browser)
class Browser; /* Define the Browser class
which is the parent
window. */
typedef struct LB_PARM{
PPXField my_field; /* Points to the field
cooresponding to this
list box */
long x; /* X coordinates of origin
point of list box */
long w; /* Width of list box */
PPXListBox my_box; /* Points to the list box
object */
PTStatic my_header; /* Points to field header
static text block object
*/
}LB_PARM;
typedef LB_PARM _FAR *PLB_PARM; /* Make DLL compatible
pointers */
typedef LB_PARM _FAR **PPLB_PARM;
// Description -------------------------------------------------------------
//
// This structure is used to define the parameters necessary to
// construct and use a list box for each field in the database.
//
// End ---------------------------------------------------------------------
// class DBDISPLAY //
_CLASSDEF(DBDISPLAY)
class DBDISPLAY:public PXDIS
{
private:
virtual const Pchar streamableName()
const /* Defines the streamable
name for this class. */
{
return "DBDISPLAY";
}
protected:
long sum; /* sum is the total number of
characters it takes to
display all the fields.
This will be used to set
the scroll bar range. */
PTWindowsObject AP; /* Copy of parent object */
int UpdateFlag; /* Update display if set */
int char_width; /* This is the maximum
character width of the
current font */
virtual Pvoid read(Ripstream); /* Read persistant object */
virtual void write(Ropstream); /* Write persistant object */
DBDISPLAY(StreamableInit): /* Persistant object
constructor */
PXDIS(streamableInit)
{
}
public:
PPLB_PARM my_parm; /* Define an array of
pointers for the fields
parameter set */
RECORDNUMBER top_rec; /* Top record number */
int item; /* List box item number */
int field; /* Number of currently
selected field */
DBDISPLAY();
static PTStreamable build(); /* Build persistant object */
int RetSum() /* Returns the total number
of characters in all
fields */
{
return sum;
}
virtual ~DBDISPLAY();
int SetUp(PBrowser AParent); /* Set up database display */
void SelRecord(int item); /* Selects the record at a
certain list box item
number */
void FillBoxes(RECORDNUMBER rec); /* Fills list boxes with
data */
void ScrollUp(); /* Scrolls the page up by one
record */
void ScrollDwn(); /* Scrolls the page down by
one record */
void IncRec(); /* Increments by one record
*/
void DecRec(); /* Decrements by one record
*/
RECORDNUMBER RetCurRec() /* Return current record */
{
return top_rec + item;
}
int RetFlag() /* Returns status of update
flag to test if display
should be updated or not
*/
{
return UpdateFlag;
}
int RetCharWidth() /* Returns the character
width for the current font
*/
{
return char_width;
}
virtual void PXError(int org); /* DBDISPLAY error handler */
int RetField() /* Return field number */
{
return field;
}
};
// Description -------------------------------------------------------------
//
// This class contains all the members necessary to initialize, browse
// and edit the database.
//
// End ---------------------------------------------------------------------
// Define inserters and extractors for persistant objects:
inline Ripstream operator >> (Ripstream is,RDBDISPLAY cl)
{return is >> (RTStreamable)cl;}
inline Ripstream operator >> (Ripstream is,RPDBDISPLAY cl)
{return is >> (RPvoid)cl;}
inline Ropstream operator << (Ropstream os,RDBDISPLAY cl)
{return os << (RTStreamable)cl;}
inline Ropstream operator << (Ropstream os,PDBDISPLAY cl)
{return os << (PTStreamable)cl;}
#endif // DBDISPLY_HPP //